using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UILogic : LuaBehivour
{
    public string assetName;

    private Action LuaOnOpen;
    private  Action LuaOnClose;
    Button button;

    public override void Init(string _luaName)
    {
        base.Init(_luaName);

        luaScriptEnv.Get("OnOpen", out LuaOnOpen);
        luaScriptEnv.Get("OnClose", out LuaOnClose);
    }

    public void UIOnOpen()
    {
        LuaOnOpen?.Invoke();
    }

    public void UIOnClose()
    {
        LuaOnClose?.Invoke();
        Manager.Pool.UnSpwan("UI", assetName, this.gameObject);
    }

    protected override void ClearLua()
    {
        base.ClearLua();

        LuaOnOpen = null;
        LuaOnClose = null;
    }
}
